<?php

namespace app\admin\controller;
use app\base\controller\Base;
use think\Request;
use think\Cache;
use think\Config;
use think\Session;


//资金流水日志
class AccountLog extends Base
{
    public  $model;

    public function __construct()
    {
   $this->model = model("UsersJournalLog");
        parent::__construct();

    }
    /**
     * @return \think\response\Json   流水日志
     */
    public function index()
    {//
        //搜索条件 时间 用户号码
        $where = [];
        $t = 60*60*24-1;
        if(isset($this->start_time)||isset($this->end_time))
        {
            if(isset($this->start_time)&&isset($this->end_time)&&($this->start_time==$this->end_time)){

                $this->end_time = $this->start_time;
                $where['a.created_at']=['between',[strtotime($this->start_time),strtotime($this->end_time)+$t]];
            }else{
                $where['a.created_at']=['between',[isset($this->start_time)?strtotime($this->start_time):strtotime("1970/1/1"),isset($this->end_time)?strtotime($this->end_time)+$t:strtotime("3030/11/1")]];
            }


        }

        //时间的处理
        if(isset($this->is_admin)){
            $where['a.is_admin'] =$this->is_admin;
        }


       $res = $this->model->defaultPage($where);
     return   resJson(1,$this->ecLang("query"),$res['res'],$res['pageInfo']);
    }









}
